package com.dzzw.Servlet.ReplyServlet;

import com.dzzw.Dao.ReplyDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/View/ReplyDeleteServlet")
public class ReplyDeleteServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    ReplyDao replyDao = new ReplyDao();
    public ReplyDeleteServlet(){
        super();
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        int response_id = Integer.parseInt(request.getParameter("response_id"));
        replyDao.ReplyDelete(response_id);
        response.sendRedirect("/View/SelectAllForum.jsp");
    }
}
